home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
sweep10.zip
/
HEAP.CPP
< prev
next >
Wrap
Text File
|
1991-04-03
|
790b
|
35 lines
////////////////
// Heap Class //
////////////////
#include <alloc.h>
#include "sweep.h"
#include "heap.hpp"
//////////////////////
// Initialize heap. //
//////////////////////
Heap::Heap (unsigned long s, unsigned b)
{
void far * base;
if (~s) s = farcoreleft(); // check if use all available
base = farmalloc (s); // allocate memory
if (b) // if blocks specified
oldheap = HeapInitBlk (base, s, b); // initialize with block count
else
oldheap = HeapInit (base, s); // initialize without block count
}
/////////////////////
// Terminate heap. //
/////////////////////
Heap::~Heap()
{
farfree (HeapSelect (oldheap)); // deallocate and switch to previous
}